<template>
  <div class="WithdrawalMethod">
    <p>提现方式</p>
    <div class="Withdrawal">
      <div class="WithdrawalBox mb60">
        <div class="one" @click="selected(1)" :class="{ active: active == 1 }">
          <img class="imgZfb" src="../assets/image/zfb.png" alt="" />
          <span>支付宝</span>
        </div>
        <!-- <div class="two" @click="bindingBtn">{{ isisBindAliPay }}</div> -->
      </div>
    </div>

    <!-- <div class="Withdrawal">
      <div class="WithdrawalBox">
        <div class="one" @click="selected(2)" :class="{ active: active == 2 }">
          <img class="imgZfb" src="../assets/image/wx.png" alt="" />
          <span>微信支付</span>
        </div>
        <div class="two" @click="bindingBtn">{{ binding }}</div>
      </div>
    </div> -->
    <span>请绑定本人账户，否则将提现失败</span>

    <div class="btn" @click="confirmBtn">
      <p>确 定</p>
    </div>
  </div>
</template>

<script>
import { diamodWithdrawWtDrawDmod } from "../api/reply";
export default {
  data() {
    return {
      active: 1,
      isisBindAliPay: "未绑定",
      id: "",
    };
  },
  methods: {
    selected(i) {
      this.active = i;
    },
    //绑定支付宝
    bindingBtn() {
      if (this.isisBindAliPay == "已绑定") {
        return;
      }
      let token = localStorage.getItem("access_token");
      this.$router.push(`/Jump?token=${token}`);
    },
    //确认按钮
    async confirmBtn() {
      const res = await diamodWithdrawWtDrawDmod({
        diamodId: this.id,
        type: this.active,
      });
      console.log(res);
      if (res.code == 0) {
        this.$router.push({
          path: "/GemWithdrawal",
          query: {
            status: res.data.status,
            errorMsg: res.data.errorMsg,
            errorCode: res.data.errorCode,
          },
        });
      }
      // else if (res.code == 1003) {
      //   alert("token过期请重新登录！");
      // }
    },
  },
  created() {
    // if (this.$route.query.isBindAliPay === "1") {
    //   this.isisBindAliPay = "已绑定";
    // }
    // if (this.$route.query.id) {
    //   this.id = this.$route.query.id;
    // }
    this.id = localStorage.getItem("txid");
  },
};
</script>

<style lang="less" scoped>
.WithdrawalMethod {
  background: #19162a;
  padding: 0px 50px;
  height: 100%;
  p {
    color: white;
    margin-bottom: 30px;
    font-size: 26px;
    padding-top: 50px;
  }
  .Withdrawal {
    width: 100%;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    color: white;
    .mb60:first-child {
      margin-bottom: 60px;
    }
    .WithdrawalBox {
      padding: 30px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 20px;
      .one {
        display: flex;
        align-items: center;
        background: url("../assets/image/one.png") no-repeat 0px;
        background-size: 40px;
        width: 80%;
        .imgZfb {
          width: 80px;
          height: 80px;
          margin: 0px 20px 0px 70px;
        }
      }
      .active {
        background: url("../assets/image/two.png") no-repeat 0px;
        background-size: 40px;
      }
      .two {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 120px;
        height: 60px;
        background: #444157;
        border-radius: 40px;
      }
    }
  }
  .btn {
    display: flex;
    justify-content: center;
    height: 120px;
    margin-top: 200px;
    p {
      width: 80%;
      height: 70px;
      background: linear-gradient(90deg, #8f41e9 0%, #3e98e6 100%);
      border-radius: 60px;
      color: white;
      font-size: 40px;
      display: flex;
      justify-content: center;
      line-height: 20px;
      font-weight: bold;
    }
  }
}
</style>